package com.dtx.controller;


import com.dtx.msg.ResultMsg;
import com.dtx.controller.in.EditUserParam;
import com.dtx.controller.in.RegisterUserParam;
import com.dtx.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 杜嘟嘟
 * @since 2021-12-11
 */

@RestController
@RequestMapping("mybatis/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/save")
    public ResultMsg save(@RequestBody @Validated RegisterUserParam param){
        ResultMsg msg = userService.saveUser(param);
        return msg;
    }

    @PostMapping("/list")
    public ResultMsg list(@RequestBody EditUserParam param){
        ResultMsg msg = userService.findUser(param);
        return msg;
    }

    @PostMapping("/xmlFindUser")
    public ResultMsg xmlFindUser(@RequestBody EditUserParam param){
        ResultMsg msg = userService.xmlFindUser(param);
        return msg;
    }

}

